<template>
  <h1>{{ title }}</h1>
  <h1>{{ msg }}</h1>
  <h1 @click="$emit('childClick', '你给我变成8')">{{ title }}</h1>
  <button @click="sendMsg">发送Child页面的消息</button>
</template>

<script>
import { ref } from 'vue'
// 事件引入
import bus from 'vue3-eventbus'

export default {
  props: {
    title: String
  },
  setup() {
    const msg = ref('我是子组件的值');
    const sendMsg = () => {
      bus.emit("getMsg", '来自Child页面的消息')
    }
    return {
      msg,
      sendMsg
    }
  }
};
</script>



